package Lee_code;

import java.util.Arrays;

/**
 * @author blh
 * @date 2024年08月26日 10:47
 */
public class Lee_334_826 {
    public boolean increasingTriplet(int[] nums) {
        int len = nums.length;
        int[] dp = new int[len];
        for (int i = 1; i < nums.length; i++) {
            if (nums[i] == nums[i - 1]) {
                continue;
            }
            if (i > 1 && (nums[i] == nums[i - 1] || nums[i] == nums[i - 2])) {
                continue;
            }
            for (int j = 0; j < i; j++) {
                if (nums[i] > nums[j]) {
                    dp[i] = Math.max(dp[i], dp[j] + 1);
                }
            }
        }
        int max = Arrays.stream(dp).max().getAsInt();
        return max >= 2;
    }
}
